*/
public $counter = -1;
+ /**
+ * @var array List of tags to apply
+ */
+ private $tags = [];
+
/**
* @var array Array of change types
*/
# Notify extensions
Hooks::run( 'RecentChange_save', [ &$this ] );
+ if ( count( $this->tags ) ) {
+ ChangeTags::addTags( $this->tags, $this->mAttribs['rc_id'],
+ $this->mAttribs['rc_this_oldid'], $this->mAttribs['rc_logid'], null );
+ }
+
# Notify external application via UDP
if ( !$noudp ) {
$this->notifyRCFeeds();
DeferredUpdates::addCallableUpdate(
function () use ( $rc, $tags ) {
+ $rc->addTags( $tags );
$rc->save();
if ( $rc->mAttribs['rc_patrolled'] ) {
PatrolLog::record( $rc, true, $rc->getPerformer() );
}
- if ( count( $tags ) ) {
- ChangeTags::addTags( $tags, $rc->mAttribs['rc_id'],
- $rc->mAttribs['rc_this_oldid'], null, null );
- }
},
DeferredUpdates::POSTSEND,
wfGetDB( DB_MASTER )
DeferredUpdates::addCallableUpdate(
function () use ( $rc, $tags ) {
+ $rc->addTags( $tags );
$rc->save();
if ( $rc->mAttribs['rc_patrolled'] ) {
PatrolLog::record( $rc, true, $rc->getPerformer() );
}
- if ( count( $tags ) ) {
- ChangeTags::addTags( $tags, $rc->mAttribs['rc_id'],
- $rc->mAttribs['rc_this_oldid'], null, null );
- }
},
DeferredUpdates::POSTSEND,
wfGetDB( DB_MASTER )
return $unserializedParams;
}
+
+ /**
+ * Tags to append to the recent change,
+ * and associated revision/log
+ *
+ * @since 1.28
+ *
+ * @param array $tags
+ */
+ public function addTags( $tags ) {
+ $this->tags = array_merge( $tags, $this->tags );
+ }
}
$rc = $this->getRecentChange( $newId );
if ( $to === 'rc' || $to === 'rcandudp' ) {
+ // save RC, passing tags so they are applied there
+ $tags = $this->getTags();
+ if ( is_null( $tags ) ) {
+ $tags = [];
+ }
+ $rc->addTags( $tags );
$rc->save( 'pleasedontudp' );
}
) {
PatrolLog::record( $rc, true, $this->getPerformer() );
}
-
- // Add change tags to the log entry and (if applicable) the associated revision
- $tags = $this->getTags();
- if ( !is_null( $tags ) ) {
- $rcId = $rc->getAttribute( 'rc_id' );
- $revId = $this->getAssociatedRevId(); // Use null if $revId is 0
- ChangeTags::addTags( $tags, $rcId, $revId > 0 ? $revId : null, $newId );
- }
}
},
DeferredUpdates::POSTSEND,